package com.grace.cms.search.lucene.domain;

import java.util.List;

/**
 * 分页结果封装类
 *
 * @param <T> 数据类型
 */
public class DocumentPage<T> {
    private List<T> content;      // 当前页数据
    private long totalElements;    // 总记录数
    private int totalPages;       // 总页数
    private int pageNumber;        // 当前页码
    private int pageSize;          // 每页大小

    public DocumentPage(List<T> content, long totalElements, int pageNumber, int pageSize) {
        this.content = content;
        this.totalElements = totalElements;
        this.pageNumber = pageNumber;
        this.pageSize = pageSize;
        this.totalPages = (int) Math.ceil((double) totalElements / pageSize);
    }

    // Getter 方法
    public List<T> getContent() {
        return content;
    }

    public long getTotalElements() {
        return totalElements;
    }

    public int getTotalPages() {
        return totalPages;
    }

    public int getPageNumber() {
        return pageNumber;
    }

    public int getPageSize() {
        return pageSize;
    }
}